 <ul id="amountArea" class="cf">
        <li>
          <label>优惠率:</label>
          <input type="text" id="yh_lv"  value="{if condition='!isset($info.yh_lv)'} 0.00 {else/} {$info.yh_lv} {/if}" class="ui-input" onchange="yh_lv()">%
        </li>
        <li>
          <label>优惠金额:</label>
          <input type="text" id="yh_e" {if condition='!isset($info.yh_e)'} value="0" {else/} value="{$info.yh_e}" {/if}class="ui-input" onchange="yh_e()">
        </li>
        <li>
          <label>优惠后金额:</label>
          <input type="text" id="yh_price"  {if condition='!isset($info.yh_price)'} value="0" {else/} value="{$info.yh_price}"{/if} class="ui-input" onchange="yh_price()" disabled>
        </li>
</ul>
<input type="hidden" name="" id="before_yh_price"  {if condition='!isset($info.before_yh_price)'} value="0" {else/} value="{$info.before_yh_price}"{/if}>
<script type="text/javascript">
  //优惠率改变
  function yh_lv() {
    var total_prices = $("#grid").getCol('total_price', false, 'sum');
    var yh_lv = $("#yh_lv").val();
    var yh_e = (total_prices * yh_lv / 100).toFixed(2);
    var yh_price = (total_prices - yh_e).toFixed(2);
    $("#yh_e").val(yh_e);
    $("#yh_price").val(yh_price);
  }

  //优惠额
  function yh_e() {
    var total_prices = $("#grid").getCol('total_price', false, 'sum');
    var yh_e = $("#yh_e").val();
    var yh_lv = (yh_e / total_prices * 100).toFixed(2);
    var yh_price = (total_prices - yh_e).toFixed(2);
    $("#yh_lv").val(yh_lv);
    $("#yh_price").val(yh_price);
  }

  //优惠后金额
  function yh_price() {
    var total_prices = $("#grid").getCol('total_price', false, 'sum');
    var yh_price = $("#yh_price").val();
    var yh_e = (total_prices - yh_price).toFixed(2);
    var yh_lv = (yh_e / total_prices * 100).toFixed(2);
    $("#yh_lv").val(yh_lv);
    $("#yh_e").val(yh_e);
  }

  // 改变底部
  // // 优惠率
  // function fun_discountRate() {
  //   var discount = $("#grid").getCol('total_price', false, 'sum');
  //   var discountRate = $('#discountRate').val() / 100;
  //   var deduction = $('#deduction').val();

  //   var newdeduction = discount * discountRate;
  //   $('#deduction').val(parseFloat(newdeduction).toFixed(2));
  //   $('#discount').val(parseFloat(discount - newdeduction).toFixed(2));
  // }

  // // 优惠金额
  // function fun_deduction() {
  //   var discount = $("#grid").getCol('total_price', false, 'sum');
  //   var deduction = $('#deduction').val();

  //   var newdiscountRate = deduction / discount;
  //   $('#discountRate').val(parseFloat(newdiscountRate * 100).toFixed(2));
  //   $('#discount').val(parseFloat(discount / 1 - deduction / 1).toFixed(2));
  // }
</script>